/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * supervision_cxc_catalogo.java
 *
 * Created on 2/06/2011, 03:02:53 PM
 */

package sie_invdis;


import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
import java.text.ParseException;
import java.text.*;

/**
 *
 * @author Michelle
 */
public class supervision_cxc_catalogo extends javax.swing.JFrame {

    private javax.swing.table.DefaultTableModel jtable_modelo_empleado;
    private javax.swing.table.DefaultTableModel jtable_modelo_estadistica;
    private javax.swing.table.DefaultTableModel jtable_modelo_inventario;
    private javax.swing.table.DefaultTableModel jtable_modelo_saldoxdepa;

    bd_conexion x = new bd_conexion();
    ResultSet rs = null;


    int fempleadoactual=0, fpreguntaactual=0,fpuestoactual=0,findicadoractual,opcioncatalogo=0,controlcomboasi=0;
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
    String textobuscaemplea="";
    
    /** Creates new form supervision_cxc_catalogo */
    public supervision_cxc_catalogo() {
        this.iniciar_modelo_empleado();
        this.iniciar_modelo_estadistica();
        this.iniciar_modelo_inventario();
        this.iniciar_modelo_saldoxdepa();
        initComponents();
        jt_catempleados.getColumnModel().getColumn(0).setPreferredWidth(30);//tem ent
        jt_catempleados.getColumnModel().getColumn(1).setPreferredWidth(80);//familia
        jt_catempleados.getColumnModel().getColumn(2).setPreferredWidth(60);//subfam.
        jt_catempleados.getColumnModel().getColumn(3).setPreferredWidth(120);//tem ent
        jt_catempleados.getColumnModel().getColumn(4).setPreferredWidth(80);//familia
        jt_catempleados.getColumnModel().getColumn(5).setPreferredWidth(40);//subfam.
        jt_catempleados.getColumnModel().getColumn(6).setPreferredWidth(60);//tem ent
        jt_catempleados.getColumnModel().getColumn(7).setPreferredWidth(30);//tem ent

        jt_saldos.getColumnModel().getColumn(0).setPreferredWidth(60);//tem ent
        jt_saldos.getColumnModel().getColumn(1).setPreferredWidth(40);//familia
        jt_saldos.getColumnModel().getColumn(2).setPreferredWidth(40);//subfam.
        jt_saldos.getColumnModel().getColumn(3).setPreferredWidth(40);//tem ent
        jt_saldos.getColumnModel().getColumn(4).setPreferredWidth(60);//familia

       this.carga_datos_empleado(opcioncatalogo,textobuscaemplea);
       this.buttonGroup1.setSelected(jrb_bdescrip.getModel(),true);
       opcioncatalogo=2;
       this.carga_datos_estadistica();
       this.carga_datos_inventario();
       this.carga_datos_saldosxdepa();
       this.loadcombodepa();
       controlcomboasi=1;
    }
private void carga_datos_empleado(int opcion,String textobusca)
   {
       //invoco al metodo que trae el recordset de datos
       //voy por el detalle del documento
       this.LimpiarJTable();
       Object[] fnewRow = new Object[8];
       rs = x.sieuno_executediversosv2("select * from x1_supervision_empleados_saldos("+opcion+",'"+textobusca+"') as (id integer,nombre text,dom_calle character varying(80),dom_colnia character varying(80),dom_pobla character varying(50),dom_codpost character varying(10),dom_codidenti character varying(20),id_tienventas integer,id_depart smallint,id_puesto smallint,id_status smallint,id_jefeinme smallint,id_tipojor smallint,fecha_nac text,fecha_alta text,fecha_baja text,rfc character varying(18),curp character varying(20),imss character varying(20),foto character varying(80),id_causabaja smallint,id_clasif smallint,id_sexo smallint,id_tiposan smallint,id_stadocivil smallint,id_sieuno integer,id_tipocon smallint,descri_depa character varying(80),descri_puesto text,descri_status character varying(25),descri_jorna character varying(25),descri_baja character varying(25),descri_clasif character varying(25),descri_sangre character varying(25),descri_stadocivil character varying(25),descri_contrato character varying(25),telefono character varying(50),email character varying(50),saldocliente numeric);",variables_global.getconexiongral());
        try
       {
            while (rs.next())
                {
                        fnewRow[0]=rs.getString("id_status")+":"+rs.getString("descri_status");
                        fnewRow[1]=rs.getString("id_depart")+":"+rs.getString("descri_depa");
                        fnewRow[2]=rs.getString("id_puesto")+":"+rs.getString("descri_puesto");
                        fnewRow[3]=rs.getString("id")+":"+rs.getString("nombre");
                        fnewRow[4]=rs.getString("dom_calle");
                        fnewRow[5]=rs.getString("telefono");
                        fnewRow[6]=rs.getString("email");
                        fnewRow[7]=rs.getString("saldocliente");
                        jtable_modelo_empleado.addRow(fnewRow);
                }
       }
        catch(Exception e)
            {
            System.out.println(e.getMessage());
            }
   }
private void carga_datos_estadistica()
   {
       //invoco al metodo que trae el recordset de datos
       //voy por el detalle del documento
      // this.LimpiarJTable();
      DecimalFormat miformat = new DecimalFormat("###,###,###,###");
       Object[] fnewRow = new Object[5];
       rs = x.sieuno_executediversosv2("select * from x1_supervision_cxc_estadistica() as (idcuenta smallint,cargos numeric,abonos numeric,saldo numeric,describecuenta character varying(40),abonoenproceso numeric);",variables_global.getconexiongral());
        try
       {
            while (rs.next())
                {
                        fnewRow[0]="<html><b><h4>"+rs.getString("idcuenta")+":"+rs.getString("describecuenta")+"</h4></b></html>";
                        fnewRow[1]="<html><b><h4>"+miformat.format(rs.getFloat("cargos"))+"</h4></b></html>";
                        fnewRow[2]="<html><b><h4>"+miformat.format(rs.getFloat("abonos")-rs.getFloat("abonoenproceso"))+"</h4></b></html>";
                        fnewRow[3]="<html><b><h4>"+miformat.format(rs.getFloat("saldo")-rs.getFloat("abonoenproceso"))+"</h4></b></html>";
                        fnewRow[4]="<html><b><h4>"+miformat.format(rs.getFloat("abonoenproceso"))+"</h4></b></html>";
                        jtable_modelo_estadistica.addRow(fnewRow);
                }
       }
        catch(Exception e)
            {
            System.out.println(e.getMessage());
            }
        int numerofilas=this.jtable_modelo_estadistica.getRowCount();
        for(int i = 0 ;i < numerofilas; i++)
           {
                jt_saldos.setRowHeight(i, 35);
           }
   }

private void carga_datos_inventario()
   {
      //invoco al metodo que trae el recordset de datos
      //voy por el detalle del documento
      // this.LimpiarJTable();
      DecimalFormat miformat = new DecimalFormat("###,###,###,###");
      Object[] fnewRow = new Object[5];
      rs = x.sieuno_executediversosv2("select * from x1_supervision_insumos_inventarioscostostipos() as (idtipo smallint,importeprecio numeric,importecosto numeric,importeprecioe numeric,importecostoe numeric,importepreciosal numeric,importecostosal numeric,describetipo character varying(40));",variables_global.getconexiongral());
      try
        {
            while (rs.next())
                {
                        fnewRow[0]="<html><b><h4>"+rs.getString("idtipo")+":"+rs.getString("describetipo")+"</h4></b></html>";
                        fnewRow[1]="<html><b><h4>"+miformat.format(rs.getFloat("importecostoe"))+"</h4></b></html>";
                        fnewRow[2]="<html><b><h4>"+miformat.format(rs.getFloat("importecostosal"))+"</h4></b></html>";
                        fnewRow[3]="<html><b><h4>"+miformat.format(rs.getFloat("importecosto"))+"</h4></b></html>";
                        fnewRow[4]="<html><b><h4>"+miformat.format(((rs.getFloat("importecostosal")*-1)/rs.getFloat("importecostoe"))*100)+"%</h4></b></html>";
                        jtable_modelo_inventario.addRow(fnewRow);
                }
        }
        catch(Exception e)
            {
            System.out.println(e.getMessage());
            }
        int numerofilas=this.jtable_modelo_inventario.getRowCount();
        for(int i = 0 ;i < numerofilas; i++)
           {
                jt_inventario.setRowHeight(i, 35);
           }
   }

private void carga_datos_saldosxdepa()
   {
      //invoco al metodo que trae el recordset de datos
      //voy por el detalle del documento
      // this.LimpiarJTable();
      DecimalFormat miformat = new DecimalFormat("###,###,###,###");
      Object[] fnewRow = new Object[2];
      rs = x.sieuno_executediversosv2("select * from x1_supervision_cxc_saldosxdepa() as (id smallint,saldo numeric,descripdepa character varying(80));",variables_global.getconexiongral());
      try
           {
            while (rs.next())
                {
                    if (rs.getFloat("saldo")>0)
                        {
                            fnewRow[0]="<html><b><h4>"+rs.getString("id")+":"+rs.getString("descripdepa")+"</h4></b></html>";
                            fnewRow[1]="<html><b><h4>"+miformat.format(rs.getFloat("saldo"))+"</h4></b></html>";
                            jtable_modelo_saldoxdepa.addRow(fnewRow);
                        }
                }
          }
      catch(Exception e)
            {
            System.out.println(e.getMessage());
            }
        int numerofilas=this.jtable_modelo_saldoxdepa.getRowCount();
        for(int i = 0 ;i < numerofilas; i++)
           {
                jt_saldosxdepa.setRowHeight(i, 25);
           }
   }

private void diodblclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:

                System.out.println("dio doble  click");
                int fila = jt_catempleados.getSelectedRow();
             
                String idcadenaemp[]=this.jt_catempleados.getValueAt(fila, 3).toString().split(":");
                //JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
                supervision_rh_edita fsrhe=new supervision_rh_edita(Integer.valueOf(idcadenaemp[0]),1);
                fsrhe.pack();
                fsrhe.setVisible(true);

    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jt_catempleados = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jLabel2 = new javax.swing.JLabel();
        jtf_busqueda = new javax.swing.JTextField();
        jbtn_buscar = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jcmbox_depart = new javax.swing.JComboBox();
        jrb_departamento = new javax.swing.JRadioButton();
        jrb_bdescrip = new javax.swing.JRadioButton();
        jrb_bclave = new javax.swing.JRadioButton();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jt_saldos = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jPanel4 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jt_inventario = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jPanel5 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jt_saldosxdepa = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jmni_escape = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(supervision_cxc_catalogo.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
        jPanel3.setName("jPanel3"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jt_catempleados.setModel(this.jtable_modelo_empleado);
        jt_catempleados.setName("jt_catempleados"); // NOI18N
        jt_catempleados.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_catempleadosMouseClicked(evt);
                if(evt.getClickCount() >= 2)
                {
                    diodblclick(evt);
                    //System.out.println(" double click" );
                }
            }
        });
        jt_catempleados.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_catempleadosMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jt_catempleados);

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jtf_busqueda.setToolTipText(resourceMap.getString("jtf_busqueda.toolTipText")); // NOI18N
        jtf_busqueda.setName("jtf_busqueda"); // NOI18N
        jtf_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_busquedaActionPerformed(evt);
            }
        });

        jbtn_buscar.setIcon(resourceMap.getIcon("jbtn_buscar.icon")); // NOI18N
        jbtn_buscar.setText(resourceMap.getString("jbtn_buscar.text")); // NOI18N
        jbtn_buscar.setName("jbtn_buscar"); // NOI18N
        jbtn_buscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_buscarActionPerformed(evt);
            }
        });

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jcmbox_depart.setToolTipText(resourceMap.getString("jcmbox_depart.toolTipText")); // NOI18N
        jcmbox_depart.setName("jcmbox_depart"); // NOI18N
        jcmbox_depart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcmbox_departActionPerformed(evt);
            }
        });

        jrb_departamento.setText(resourceMap.getString("jrb_departamento.text")); // NOI18N
        jrb_departamento.setToolTipText(resourceMap.getString("jrb_departamento.toolTipText")); // NOI18N
        jrb_departamento.setActionCommand(resourceMap.getString("jrb_departamento.actionCommand")); // NOI18N
        jrb_departamento.setName("jrb_departamento"); // NOI18N
        jrb_departamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrb_departamentoActionPerformed(evt);
            }
        });

        jrb_bdescrip.setText(resourceMap.getString("jrb_bdescrip.text")); // NOI18N
        jrb_bdescrip.setToolTipText(resourceMap.getString("jrb_bdescrip.toolTipText")); // NOI18N
        jrb_bdescrip.setActionCommand(resourceMap.getString("jrb_bdescrip.actionCommand")); // NOI18N
        jrb_bdescrip.setName("jrb_bdescrip"); // NOI18N
        jrb_bdescrip.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrb_bdescripActionPerformed(evt);
            }
        });

        jrb_bclave.setText(resourceMap.getString("jrb_bclave.text")); // NOI18N
        jrb_bclave.setToolTipText(resourceMap.getString("jrb_bclave.toolTipText")); // NOI18N
        jrb_bclave.setActionCommand(resourceMap.getString("jrb_bclave.actionCommand")); // NOI18N
        jrb_bclave.setName("jrb_bclave"); // NOI18N
        jrb_bclave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrb_bclaveActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(108, 108, 108)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jrb_bclave)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(36, 36, 36)
                        .addComponent(jrb_bdescrip)
                        .addGap(28, 28, 28)
                        .addComponent(jrb_departamento))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31)
                        .addComponent(jbtn_buscar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcmbox_depart, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(234, Short.MAX_VALUE))
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 877, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtn_buscar)
                    .addComponent(jLabel1)
                    .addComponent(jcmbox_depart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jrb_departamento)
                    .addComponent(jrb_bclave)
                    .addComponent(jrb_bdescrip))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jt_saldos.setModel(this.jtable_modelo_estadistica);
        jt_saldos.setName("jt_saldos"); // NOI18N
        jScrollPane2.setViewportView(jt_saldos);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel4.border.title"))); // NOI18N
        jPanel4.setName("jPanel4"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        jt_inventario.setModel(this.jtable_modelo_inventario);
        jt_inventario.setName("jt_inventario"); // NOI18N
        jScrollPane3.setViewportView(jt_inventario);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 435, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel5.border.title"))); // NOI18N
        jPanel5.setName("jPanel5"); // NOI18N

        jScrollPane4.setName("jScrollPane4"); // NOI18N

        jt_saldosxdepa.setModel(this.jtable_modelo_saldoxdepa);
        jt_saldosxdepa.setName("jt_saldosxdepa"); // NOI18N
        jScrollPane4.setViewportView(jt_saldosxdepa);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
        );

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
        jmni_escape.setName("jmni_escape"); // NOI18N
        jmni_escape.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_escapeActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_escape);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel3.getAccessibleContext().setAccessibleName(resourceMap.getString("jPanel3.AccessibleContext.accessibleName")); // NOI18N

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_jmni_salirActionPerformed
 void LimpiarJTable()
 {
     //limpiar la tabla
    while(jtable_modelo_empleado.getRowCount()>0)jtable_modelo_empleado.removeRow(0);
 }


    private void jtf_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_busquedaActionPerformed
        // TODO add your handling code here:
        this.jbtn_buscarActionPerformed(evt);
}//GEN-LAST:event_jtf_busquedaActionPerformed
    private void jbtn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarActionPerformed
        // TODO add your handling code here:
        // this.jtf_busqueda.getText();
        if(JOptionPane.showConfirmDialog(null, "Estan Correctos sus Datos?")==0) {
            this.carga_datos_empleado(opcioncatalogo, this.jtf_busqueda.getText().trim().toUpperCase());
        } else {
            this.jtf_busqueda.requestFocus();
        }

    }//GEN-LAST:event_jbtn_buscarActionPerformed

    private void jrb_departamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_departamentoActionPerformed
        // TODO add your handling code here:
        opcioncatalogo=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_departamentoActionPerformed

    private void jrb_bdescripActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bdescripActionPerformed
        // TODO add your handling code here:
        opcioncatalogo=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bdescripActionPerformed

    private void jrb_bclaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bclaveActionPerformed
        // TODO add your handling code here:
        opcioncatalogo=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bclaveActionPerformed

    private void jcmbox_departActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbox_departActionPerformed
        // TODO add your handling code here:
        if(controlcomboasi==1) {

            String arreglo_depasi[]=this.jcmbox_depart.getSelectedItem().toString().split(":");
            opcioncatalogo=1;
            this.buttonGroup1.setSelected(jrb_departamento.getModel(),true);
            this.jtf_busqueda.setText(arreglo_depasi[0]);
            this.jbtn_buscarActionPerformed(evt);


        }
}//GEN-LAST:event_jcmbox_departActionPerformed

    private void jt_catempleadosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_catempleadosMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jt_catempleadosMouseClicked

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed
private void iniciar_modelo_empleado()
    {
        jtable_modelo_empleado=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_empleado.addColumn("<html><b>Status</b></html>");
        jtable_modelo_empleado.addColumn("<html><b>Dep.</b></html>");
        jtable_modelo_empleado.addColumn("<html><b>Puesto</b></html>");
        jtable_modelo_empleado.addColumn("<html><b>Nombre</b></html>");
        jtable_modelo_empleado.addColumn("<html><b>Domicilio</b></html>");
        jtable_modelo_empleado.addColumn("<html><b>telefono</b></html>");
        jtable_modelo_empleado.addColumn("<html><b>email</b></html>");
        jtable_modelo_empleado.addColumn("<html><b>Saldo</b></html>");
    }
private void iniciar_modelo_estadistica()
    {
        jtable_modelo_estadistica=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_estadistica.addColumn("<html><b>Concepto</b></html>");
        jtable_modelo_estadistica.addColumn("<html><b>Cargos</b></html>");
        jtable_modelo_estadistica.addColumn("<html><b>Abonos</b></html>");
        jtable_modelo_estadistica.addColumn("<html><b>Saldo</b></html>");
        jtable_modelo_estadistica.addColumn("<html><b>A. en Proceso</b></html>");
    }
private void iniciar_modelo_inventario()
    {
        jtable_modelo_inventario=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_inventario.addColumn("<html><b>Tipo Insumo</b></html>");
        jtable_modelo_inventario.addColumn("<html><b>C.Entrada</b></html>");
        jtable_modelo_inventario.addColumn("<html><b>C.Salidas</b></html>");
        jtable_modelo_inventario.addColumn("<html><b>Actual</b></html>");
        jtable_modelo_inventario.addColumn("<html><b>Rotacion</b></html>");
    }
private void iniciar_modelo_saldoxdepa()
    {
       jtable_modelo_saldoxdepa=new javax.swing.table.DefaultTableModel();//Creo el modelo
       jtable_modelo_saldoxdepa.addColumn("<html><b>Departamento</b></html>");
       jtable_modelo_saldoxdepa.addColumn("<html><b>Saldo</b></html>");
    }

private void loadcombodepa(){

          rs = x.sieuno_executediversosv2("select * from x1_supervision_tareas_departamentos() as (id smallint,descrip character varying(80));",variables_global.getconexiongral());
            try
            {

               while (rs.next())
                    {
                      this.jcmbox_depart.addItem(rs.getString("id")+":"+rs.getString("descrip"));


                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }
//jtable_modelo_saldoxdepa
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new supervision_cxc_catalogo().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JButton jbtn_buscar;
    private javax.swing.JComboBox jcmbox_depart;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JRadioButton jrb_bclave;
    private javax.swing.JRadioButton jrb_bdescrip;
    private javax.swing.JRadioButton jrb_departamento;
    private javax.swing.JTable jt_catempleados;
    private javax.swing.JTable jt_inventario;
    private javax.swing.JTable jt_saldos;
    private javax.swing.JTable jt_saldosxdepa;
    private javax.swing.JTextField jtf_busqueda;
    // End of variables declaration//GEN-END:variables

}
